//
//  BeanGunTime.m
//  RtspClient
//
//  Created by qi tan on 2024/1/8.
//  Copyright © 2024 Andres Rojas. All rights reserved.
//

#import "BeanGunTime.h"

@implementation BeanGunTime

- (instancetype)initWithDict:(NSDictionary *)dict {
    if(self = [super init]) {
        [self setValuesForKeysWithDictionary:dict];
//        self.curRange = [dict[@"curRange"] intValue];
    }
    return self;
}

+ (instancetype)beanWithDict:(NSDictionary *)dict {
    return [[self alloc]initWithDict:dict];
}

- (NSString *)description {
    return [NSString stringWithFormat:@"GunTime---: time:%@, timeFormat:%@", self.time, self.timeformat];
}

// 获取显示时间:eg:2023/05/06 22:03
- (NSString *)getShowTime {
    int year = [[self.time substringWithRange:NSMakeRange(0, 4)] intValue];
    int month = [[self.time substringWithRange:NSMakeRange(4, 2)] intValue];
    int dayOfMonth = [[self.time substringWithRange:NSMakeRange(6, 2)] intValue];
    int hour = [[self.time substringWithRange:NSMakeRange(8, 2)] intValue];
    int minute = [[self.time substringWithRange:NSMakeRange(10, 2)] intValue];
    int second = [[self.time substringWithRange:NSMakeRange(12, 2)] intValue];

    return [NSString stringWithFormat:@"%4d/%02d/%02d %02d:%02d",
            year,month,dayOfMonth, hour,minute];
}




@end
